package ay.mq;

import ay.dto.MoodDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessagePostProcessor;
import org.springframework.stereotype.Component;

import javax.jms.Destination;
import java.util.logging.Logger;

@Component
public class MoodProducer {

    @Autowired
    private JmsTemplate jmsTemplate;

    private Logger logger = Logger.getLogger(String.valueOf(this.getClass()));

    public void sendMessage(Destination destination, final MoodDTO moodDTO){
        logger.info("生产者--->>>用户id："+ moodDTO.getUserId()+"给说说id"+moodDTO.getId()+"点赞");

        jmsTemplate.convertAndSend(destination, moodDTO);
    }

}
